﻿/***************************************************************************
*		功能：     收支明细实体类(代码生成工具搞定的)
*		作者：     Sands
*		日期：     2012-09-08 06:26
*		
*		修改日期：
*		修改人：
*		修改内容：
/* *************************************************************************/
using System;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.IO;
using System.Text;
using System.Data;
using Sands.DataAccess;
using Sands.Common;
using System.Collections.Generic;
using System.Linq;
namespace SAWeb.Model
{
	/// <summary>
	/// 收支明细
	/// </summary>
	[Serializable]
	[HTable( TableName = "Detail" ,  Remake = "收支明细")]
	public partial class Detail :  IModel 
	{
        /// <summary>
        /// 是否新参数
        /// </summary>
        public bool IsNewModel() { return DetailId == 0; } 

	    
		/// <summary>
		/// 明细ID
		/// </summary>
		[HColumn( Remake = "明细ID" ,  IsPrimary = true ,  IsIdentity = true)]
		public int DetailId { set; get; }
        

		/// <summary>
		/// 收支类型
		/// </summary>
		[HColumn( Remake = "收支类型")]
		public bool IsGet { set; get; }
        

		/// <summary>
		/// 内容
		/// </summary>
		[HColumn( Remake = "内容" ,  Length = 500 ,  IsNullable = true)]
		public string Contents { set; get; }
        

		/// <summary>
		/// 收支项目
		/// </summary>
		[HColumn( Remake = "收支项目")]
		public int Project { set; get; }
        

		/// <summary>
		/// 收支方式
		/// </summary>
		[HColumn( Remake = "收支方式")]
		public int CardId { set; get; }
        

		/// <summary>
		/// 金额
		/// </summary>
		[HColumn( Remake = "金额" ,  Length = 10)]
		public string Money { set; get; }
        

		/// <summary>
		/// 用户
		/// </summary>
		[HColumn( Remake = "用户")]
		public int UserId { set; get; }
        

		
		
        
		private Lazy<Card> _Card;
        [NotColumn]
		public  Lazy<Card> Card 
		{ 
			get
			{
				if (_Card.IsNotNull()) return _Card;
				else
				{
					_Card = new Lazy<Card>(() => { return new BaseService<Card>().GetModelById(CardId); });
					return _Card;
				}			
			}
		}
		

        
		private Lazy<Users> _User;
        [NotColumn]
		public  Lazy<Users> User 
		{ 
			get
			{
				if (_User.IsNotNull()) return _User;
				else
				{
					_User = new Lazy<Users>(() => { return new BaseService<Users>().GetModelById(UserId); });
					return _User;
				}			
			}
		}
		


		
	}

	public partial class Db
	{
			public static class Detail 
			{

				static  Detail ()
				{
				 
					DetailId = new Field("Detail","DetailId");
				 

					IsGet = new Field("Detail","IsGet");
				 

					Contents = new Field("Detail","Contents");
				 

					Project = new Field("Detail","Project");
				 

					CardId = new Field("Detail","CardId");
				 

					Money = new Field("Detail","Money");
				 

					UserId = new Field("Detail","UserId");
				 

				}
    			 
				 /// <summary>
				 /// 明细ID
				 /// </summary>
				 public static Field DetailId { private set;get; }
	    		 

				 /// <summary>
				 /// 收支类型
				 /// </summary>
				 public static Field IsGet { private set;get; }
	    		 

				 /// <summary>
				 /// 内容
				 /// </summary>
				 public static Field Contents { private set;get; }
	    		 

				 /// <summary>
				 /// 收支项目
				 /// </summary>
				 public static Field Project { private set;get; }
	    		 

				 /// <summary>
				 /// 收支方式
				 /// </summary>
				 public static Field CardId { private set;get; }
	    		 

				 /// <summary>
				 /// 金额
				 /// </summary>
				 public static Field Money { private set;get; }
	    		 

				 /// <summary>
				 /// 用户
				 /// </summary>
				 public static Field UserId { private set;get; }
	    		 

			}
	}
}